//package cn.wen233.srpc.core.spring.client;
//
//import cn.wen233.srpc.basic.utils.ClassUtils;
//import cn.wen233.srpc.basic.utils.StringUtils;
//import cn.wen233.srpc.core.holder.ClientServiceHolder;
//import cn.wen233.srpc.core.holder.ServerServiceHolder;
//import cn.wen233.srpc.core.service.SunglowService;
//import cn.wen233.srpc.core.utils.IocUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.BeansException;
//import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
//import org.springframework.beans.factory.support.BeanDefinitionRegistry;
//import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
//
//import java.util.Set;
//
///**
// * Spring 注册代理Bean 到容器中
// *
// * @author wenjie
// * @date 2022-04-21 23:37
// */
//@Slf4j
//public class ReferenceRegisterProcessor implements BeanDefinitionRegistryPostProcessor {
//
//
//    @Override
//    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
//
//    }
//
//    @Override
//    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
//        Set<Class<?>> allClasses = ClassUtils.findAllClasses("");
//        for (Class<?> clazz : allClasses) {
//            if (clazz.isAnnotationPresent(SunglowService.class)) {
//                SunglowService sunglowService = clazz.getDeclaredAnnotation(SunglowService.class);
//                Class<?> interfaceClass = sunglowService.interfaceClass();
//                if (interfaceClass.equals(Void.class)) {
//                    // 如果没有指定具体代理哪个接口，则取第一个
//                    interfaceClass = clazz.getInterfaces()[0];
//                }
//                log.info("扫描到 @SunglowService={}", interfaceClass.getName());
//                beanFactory.registerSingleton(
//                        StringUtils.largeHumpConvertSmallHump(interfaceClass.getSimpleName()),
//                        ClientServiceHolder.getProxy(interfaceClass)
//                );
//            }
//        }
//    }
//}
